import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LXW
 * Date: 2022-04-09
 * Time: 21:19
 */
public class UdpDirServer extends UdpEchoServer{
    HashMap<String,String> map = new HashMap<>();
    public UdpDirServer(int port) throws SocketException {
        super(port);
        map.put("dog","小狗");
        map.put("cat","小猫");
        map.put("pig","小猪");
    }
    @Override
    public String  process(String request) {
        return map.getOrDefault(request,"该词无法被解释");
    }
    public static void main(String[] args) throws IOException {
        UdpDirServer dirServer = new UdpDirServer(9090);
        dirServer.start();
    }
}
